package com.tansun.ruledata.data.entity;

import org.hibernate.validator.constraints.Length;

import com.tansun.easycare.core.persistence.BaseEntity;

/**
 * 规则发布Entity
 *
 * @author lixs
 * @version 2017-04-11
 */
public class DeployEnterpoint extends BaseEntity {

    private static final long serialVersionUID = 1L;
    private String projectCode;        // 规则库编码
    private String deploymentId;        // 发布信息ID
    private String name;        // 中文名称
    private String code;        // 调用编码
    private String control;        // 开关标识
    private String description;        // 规则流描述
    private String ruleflowId;        // 规则流ID
    private String dataComponentIds;
    private String dataComponentNames;
    private String partnerId; //合作方标识
    private String appKey;//应用标识
    private String eventType;//事件类型
    private String dataVersion;
    public DeployEnterpoint() {
        super();
    }

    public DeployEnterpoint(String id) {
        super(id);
    }

    @Length(min = 1, max = 50, message = "规则库编码长度必须介于 1 和 50 之间")
    public String getProjectCode() {
        return projectCode;
    }

    public void setProjectCode(String projectCode) {
        this.projectCode = projectCode;
    }

    @Length(min = 0, max = 50, message = "发布信息ID长度必须介于 0 和 50 之间")
    public String getDeploymentId() {
        return deploymentId;
    }

    public void setDeploymentId(String deploymentId) {
        this.deploymentId = deploymentId;
    }

    @Length(min = 0, max = 50, message = "中文名称长度必须介于 0 和 50 之间")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Length(min = 0, max = 50, message = "调用编码长度必须介于 0 和 50 之间")
    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Length(min = 0, max = 10, message = "开关标识长度必须介于 0 和 10 之间")
    public String getControl() {
        return control;
    }

    public void setControl(String control) {
        this.control = control;
    }

    @Length(min = 0, max = 10, message = "规则流描述长度必须介于 0 和 10 之间")
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Length(min = 0, max = 50, message = "规则流ID长度必须介于 0 和 50 之间")
    public String getRuleflowId() {
        return ruleflowId;
    }

    public void setRuleflowId(String ruleflowId) {
        this.ruleflowId = ruleflowId;
    }

    public String getDataComponentIds() {
        return dataComponentIds;
    }

    public void setDataComponentIds(String dataComponentIds) {
        this.dataComponentIds = dataComponentIds;
    }

    public String getDataComponentNames() {
        return dataComponentNames;
    }

    public void setDataComponentNames(String dataComponentNames) {
        this.dataComponentNames = dataComponentNames;
    }

    public String getPartnerId() {
        return partnerId;
    }

    public void setPartnerId(String partnerId) {
        this.partnerId = partnerId;
    }

    public String getAppKey() {
        return appKey;
    }

    public void setAppKey(String appKey) {
        this.appKey = appKey;
    }

    public String getEventType() {
        return eventType;
    }

    public void setEventType(String eventType) {
        this.eventType = eventType;
    }
    
	public String getDataVersion() {
		return dataVersion;
	}

	public void setDataVersion(String dataVersion) {
		this.dataVersion = dataVersion;
	}

	public String getSql() {
		return "INSERT INTO rule_enterpoint(id,project_code,deployment_id,name,code,control,description,ruleflow_id,data_version) values(?,?,?,?,?,?,?,?,?)";
	}
	
	public String getExeSql() {
		return "INSERT INTO rule_exe_enterpoint(id,project_code,deployment_id,name,code,control,description,ruleflow_id,data_version) values(?,?,?,?,?,?,?,?,?)";
	}
	
	public Object[] getArgs(String timeStamp) {
		return new Object[] {this.id,this.projectCode,this.deploymentId,this.name,this.code,this.control,this.description,this.ruleflowId,timeStamp};
	}
}